package edu.unc.comp410.colemangeer.model.object;

import edu.unc.comp410.sharedcode.Observer;



/**
 * The subset of the member functions of class <CODE>Object</CODE>
 * that should normally be overridden for any "standard",
 * reusable class.
 * 
 * Excludes the Object member functions that do not need to be
 * overridden: finalize, getClass, notify, notifyAll, wait.
 * 
 * Re-abstract <CODE>equals</CODE>, <CODE>hashCode</CODE>.
 * and <CODE>toString</CODE> forcing implementations to 
 * redefine these member functions. This explicitly avoids
 * accidental inheritance of Objects's versions of these.
 */
public interface IStandardObject { 
	
	/**
	 *  Indicates whether theObject is "equivalent to" theObject.
	 *  @requires true
	 *  @properties reflexive, symmetric, transitive,  
	 *  consistent, and no object equals null
	 *      x.equals(x) AND
	 *      If x.equals(y) then y.equals(x) AND
	 *      If x.equals(y) AND y.equals(z) then x.equals(z) AND
	 *     	If x.equals(y) then x.equals(y) AND
	 *      If x != null then ! x.equals(null)
	 */
	@Observer abstract boolean equals( Object theObject );
	
	/**
	 * Returns a hash code value for the object.
	 * @requires true
	 * @returns equal objects muat have the same hashCode 
	 * 		If x.equals(y) then x.hashCode() == y.hashCode() 
	 * 		Note that the converse of this is not necessarily true.
	 */
	@Observer abstract int hashCode();
	
	/**
	 * Returns a <CODE>String</CODE> representation of the object.
	 * @requires true
	 * @returns a <CODE>string</CODE> representation of the object.
	 */
	@Observer abstract String toString();
	
	/**
	 * May also want an inverse of <CODE>toString()</CODE>:
	 *    MyType string2Object( String inString )
	 * @requires true
	 * @ensures x.equals( string2Object( x.toString() ))
	 */

}

